package b3.widget.home.operation
{
	import b3.model.*;
	import b3.net.*;
	import b3.widget.*;
	import b3.widget.basic.*;
	import b3.widget.home.social.*;
	import b3.scene.home.*;
	
	import flash.events.MouseEvent;
	
	public class OperationScanInfo extends BasicIcon
	{
		private var buildingModel:BuildingModel;
		
		public function OperationScanInfo(buildingModel:BuildingModel)
		{
			this.buildingModel = buildingModel;
			//应该改成查看按钮
			var IconBgr:Class = ResourceHelper.getInstance().getClassByName("OperationDetail");
			super(IconBgr, "查看", 1, true);
			disableMouseOverTip();
			addEventListener(MouseEvent.CLICK, onMouseClick);
			this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
		}
		
		private function onMouseOver(event:MouseEvent):void
		{
			HomeScene.getInstance().centerInfoPane.showOperationTip("OperationRemove", "查看建筑历史信息", 0x00AAFF);
		}
		
		private function onMouseOut(event:MouseEvent):void
		{
			HomeScene.getInstance().centerInfoPane.clear();
		}
		
		private function onMouseClick(event:MouseEvent):void
		{
			var bsid:BuildingSocialInfoDialog = new BuildingSocialInfoDialog(buildingModel);
			bsid.x = -bsid.width / 2;
			bsid.y = -bsid.height / 2;
			WidgetManager.getInstance().popOut([bsid], true);
		}
	}
}